#ifndef FaceAccessor_HPP
#define FaceAccessor_HPP
#include "GeometryTypes.hpp"
#include <boost/signal.hpp>

class FaceAccessor
{
   public:

      FaceAccessor(FaceList* aFaceList) : mFaceList(aFaceList) {}

      const Face& operator[](int aIndex) const
      {
         if (mFaceList != 0)
         {
            return (*mFaceList)[aIndex];
         }
         else
         {
            static Face v;
            return v;
         }
      }

      const FaceList& Get() const
      {
         if (mFaceList) return (*mFaceList);
         static FaceList v;
         return v;
      }

      FaceList& Get()
      {
         if (mFaceList) return (*mFaceList);
         static FaceList v;
         return v;
      }

      boost::signal<void()> Updated;

      size_t size() const { if (mFaceList) return mFaceList->size(); else return 0; }

      bool IsValid() const { return mFaceList != 0; }

      void SetFaceList(FaceList* aFaceList) { mFaceList = aFaceList; }

   private:
      FaceList*   mFaceList;
};

#endif